package com.yedean.factory.aop.aspectj;

import com.yedean.factory.aop.PointCut;
import com.yedean.factory.aop.framework.PointcutAdvisor;
import org.aopalliance.aop.Advice;

public class AspectJExpressionPointcutAdvisor implements PointcutAdvisor {
    
    private Advice advice;
    
    private AspectJExpressionPointCut pointCut;
    
    private String expression;


    public void setAdvice(Advice advice) {
        this.advice = advice;
    }

    public void setExpression(String expression) {
        this.expression = expression;
    }

    @Override
    public Advice getAdvice() {
        return advice;
    }

    @Override
    public PointCut getPointcut() {
        if (null==pointCut){
            return new AspectJExpressionPointCut(expression);
        }
        return pointCut;
    }
}
